package com.itheima.tcp;

import java.io.*;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.1.0",10000);
        FileInputStream fis = new FileInputStream("day16_网络编程\\课程安排.png");
        OutputStream os = socket.getOutputStream();

        int i;
        byte[] bytes = new byte[1024];
        while((i = fis.read(bytes))!=-1){
            os.write(bytes,0,i);
        }
        socket.shutdownOutput();

        InputStream is = socket.getInputStream();
        int b = is.read(bytes);
        System.out.println(new String(bytes,0,b));

        fis.close();
        socket.close();
    }
}
